package com.rc.saas.tenant;

import com.rc.saas.tenant.config.TransactionAdviceConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Import;

/**
 * 此启动类应处于最上层的目录中，这样项目启动时，该目录以及下级目录的类都会被扫描
 * 继承SpringBootServletInitializer,使Spring Boot支持JSP
 */
@EnableDiscoveryClient
@EnableFeignClients //Feign
@Import(TransactionAdviceConfig.class)
@SpringBootApplication(exclude = {
        QuartzAutoConfiguration.class,
        SecurityAutoConfiguration.class,
        MultipartAutoConfiguration.class})
public class RcTenantBootApplication extends SpringBootServletInitializer {
    /**
     * 复写该方法，使Spring Boot支持JSP
     * @param application
     * @return
     */
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(RcTenantBootApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(RcTenantBootApplication.class, args);
    }

}
